package it.polimi.travelDream.web.beans;


import java.util.ArrayList;
import java.util.List;

import it.polimi.it.TravelDream.ejb.UserMgr;
import it.polimi.it.TravelDream.ejb.eaos.PurchasDTO;
import it.polimi.it.TravelDream.ejb.eaos.PurchaseMgr;

import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;

/**
 * Session Bean implementation class PurchaseBean
 */
@ManagedBean
@RequestScoped
public class PurchaseBean {
	
	@EJB
	private PurchaseMgr purchaseMgr;
	
	@EJB
	private UserMgr userMgr;
	
	private List<PurchasDTO> purchaseList;
	
	
	
	
	public List<PurchasDTO> getPurchaseList() {
		return purchaseList;
	}

	public void setPurchaseList(List<PurchasDTO> purchaseList) {
		this.purchaseList = purchaseList;
	}

	@PostConstruct
	public void getUserPurchasesList() {
		//hotelsList = new ArrayList<HotelDTO>();
		purchaseList = new ArrayList<PurchasDTO>();
	 //	System.out.println(search.getKeySearch());
	purchaseList = purchaseMgr.getPurchasesList(userMgr.getUserDTO().getEmail());    //search(search.getKeySearch());
	//hotelsList = basicProdMgr.getHotelsList();
	//	System.out.println(hotelsList.get(0).getCity());
		
	}

    /**
     * Default constructor. 
     */
    public PurchaseBean() {
        // TODO Auto-generated constructor stub
    }

}
